Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: define common_gypi_dir when running node-gyp configure #2973

Closed
wants to merge 2 commits into from

Conversation

toyobayashi
Copy link
Contributor

@toyobayashi toyobayashi commented Jan 26, 2024

Checklist
  • npm install && npm run lint && npm test passes
  • commit message follows commit guidelines
Description of change

Refs:

I'm trying to add node-gyp support to emnapi, some upstream changes are made in nodejs/gyp-next#222. I'd like to add the linker option --js-library=<(common_gypi_dir)/dist/library_napi.js in emnapi's common.gypi' (used via --nodedir). The --js-library need to receive an absolute path because relative path doesn't work when emcc runs in node-gyp build stage the CWD is ${projectRoot}/build. But I can't find a way to set the --js-library relative to the nodedir or common_gypi_dir. See nodejs/gyp-next#222 (comment) for more detail description about this. I know there are <(node_root_dir) and <(nodedir), but there is no guarantee that they are absolute path.

Adding a -D affects almost nothing. It would be great if someone could tell that there is a better way.

@toyobayashi
Copy link
Contributor Author

found solution:

{
  'libraries': [
    '--js-library=<!(node -p "path.resolve(process.argv[1],\'dist/library_napi.js\').replace(process.argv[2],\'/\')" "<(node_root_dir)" "\\\\")'
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant